Fixes bug where non-json string will cause a crash