libs fix and cleanup