Fixed clearTable function