Fix bug causing bad POST request to cause infinite loop.