changed error code to 500