Fixed erroneous return with a continue

This bug stopped the flushing of the event queue by returning too early
Merge pull request #347 from TheNeikos/fix-input_event_loop

Fixed erroneous return with a continue
Destruct the message when parser failure occured
Add checks whether there are statements or a statements array

To be able to deinitialize properly.
Merge pull request #348 from matthiasbeyer/add-json_deserializer_cleanup_on_failure

Add message destruction on failure