bug fix in clear method