fix(ChangeDetector): fix issues with handling empty ranges

True. I will add a test.