Set HTTP status code to 500 on error

Fixes #5.