fix web ui fatal errors

Fixes #611 #614 #613 
Stop apologising, it was a complex PR :-)