some sanity and cleanup