Yes, I know why you put a wait there and it is correct. What I mean is, that the me pointer might not longer be pointing on your glass object after the wait(1). It might already point to the next entity or nowhere.

Does your code work when you comment the line with the "effect_sprite"? Since you said you know how to debug I'm sure that it does(?).