fix race condition in screen refresh

- add dispose method fields
- check for null position in all connection callbacks

fixes #988
update frontend.js
Merge pull request #990 from simplysoft/fix-988

Fix race conditions in screen refresh