Fixed JS in game function