bug fix on cleanup