Looks like this code ignores first portion of data stored in 'chunk' for first loop, is it should be like that?