added synchronization on gm.update and gm.handleKeyPress (a new method)
to avoid thread race conditions which fixes the bug Yile caught with a
fish being generated immediately after it was caught.