added contiguous record end detection