Changed 400 to 500 on error