changed the way check the loaded library and fix syntax errors