How about trying wait(1) instead of sleep.
NOTE: Sleep is a pre GS v6.3 function that will be soon discontinued altogether.
The new sleep is wait(-1) for seconds where as wait(1) is for frame.
You need to use the wait in a while loop otherwise wierd things do happen
and can even crash your game.
Please read your manual about wait().