addressing a few bugs in the clean_library function.