bugfixes and auto-column detection