Fixed clean_target function