fixed javascript game bug