Ask God to purify your thoughts and imagination with this prayer
Sometimes our own mind is our worst enemy and needs to be cleansed by God.
Here is a brief prayer from the Golden Manual that can be prayed before receiving Holy Communion.
May this Communion deliver me from the tyranny of my bad thoughts, break off the yoke of my evil habits, and dispose me always to the practice of your holy commandments. Let nothing separate me from you, O Jesus; not the attractions of the world, nor the illusions of sense, nor the wanderings of my imagination, nor the evil passions of my heart.