Fix a couple bugs. Fix order of execution for table creation