Add a failing tests to reproduce an uncaught error
Fix a potential crash in the client handler