fixed clearing bugs