Finally fixed the multipart JSON-decoding bugs

Fixes #288
Fixes #289