added debug output for csv files, haven't tested nonempty files yet