Corrected a bug creating a new record at every fetch
correcting bugs in the fetching algorithm