fixed game code to work with ui