added termination cleanup