returns http status 500 on error