fixed a few annoying null pointer exceptions in the client side code
(was hard to track down with obfuscated js so I found out how to pretty
print it)