fixed the clear function