fixed 404 status code and added 500 status code for exception