fix(ChangeDetector): fix issues with handling empty ranges

`record = record.recordRange.headRecord.prev;`  (tail -> head)