Fix a potential crash in the client handler