Fixed bug that forgot to run pre and post action commands
Added a flush command to make __init__ actions work
Added simple error logging to jsonize function