Fix HTTP status code usage; use constants for them

Also updates some error messages