fix some bugs with http body parsing