Server: fixed cast exception when client reports an error