Hi Sanotsh,
Hhhhhmmmm your algorithm looks good to me at a frist sight. To be honest I am not sure what the problem is.
Very dumb idea, have you already tried it with a larger change, let's say 1 GB, just want to make sure that there is not any kind of caching problem around.
--
Thomas G.