fix and cleanup