bugfixes, game loop