Added debug mode. Fixed crash on reload