added 500 error handling middleware and its test