Fixed table clearing bugs