weird type error when refactoring gamestate