Fixed a bug where the game tried to access outside bounds