Fixed bug caused by text clearing befoe button p[ressed