Bug fixes+fix for exporting as a jar