cleanup some functions