Protection of usage

Added several protection if to avoid using library functions without
initializing