Ok, I fixed some bugs. It should now work properly.
It's working fine now. Are you planning to make more levels?