More testing and bug fixing

Fix a bug in the dry run mode when there is no sample data
Add more table qualification to column references.