added check if library is loaded