Fixed the infinite loop bug in jsnes.