Rfb js fixes

Bugfixes and cleanup.

Found this ones when testing in a Chrome 30. Might have worked before due to some similarity between Interval and  Timeout, but it disconnected in Chrome 30.