Fix clean up routines.