improve error handling

Invalid JSON formatting was causing DOM to leave. Jumping to next
line is a better solution.