Fixing if 'library' key and  object exist.