added handling bad requests