invalid error should send a 400 code

Fixed the bug