fixed bug where bad request was being incorrectly sent on valid requests.