Fix delete table function