fixed possible leak of error to client