add flush values
set flush param and set error str for reads
move util functions to mod utils