bug fix for cleanup