Prevent import emty rows in dataset, fix for github issue #409, refactors