Fixed the behaviour of the clearbutton