Write/Read 4096 bytes at a time
Fix some warnings