fix cleanup code.