change on behavior: replace can now replace empty data, like to add data on eof