add MODE_ALL instead of letting 0 mean all
return amount of data
cast to correct data type
don't care about data-format for the console print-out
fix test