fix /profile endpoint error handling based on @pablohoffman and @dangra comments