fixed a bug due to which number of reads to read in a buffer was set to 0