fix clear function