Fix table recreation queries