fixing bug in clear