Fix bug related to creating database tables