fix the clear function