Improve error handling, do not crash websocket on erroneous calls