add a way to perform checksum
fix eof check