Flies find their food by casting spells.
Video of fly casting a spell https://thumbs.gfycat.com/DeafeningGoodnaturedBunny-max-1mb.gif
Normally these spells lead them to the food unerringly. Unfortunately the magic they use does not seem to recognise glass. It safely leads them around walls and corners and all sorts of opaque surfaces but somehow it tries to lead them straight through glass thus causing the fly a lot of confusion.
How can I explain a magic that is not all-knowing? Is there a remedy?