Fix a few parsing bugs that can allow for silent truncation of valid JSON