More bugfixes for sql import