I think the reason for those bugs occuring is just because you reset the level too early? Might have to do some testing but that's probably the issue