Improve message for InvalidFormatError and make misformatted int flags return status 400 rather than status 500