Fix improper computation and complete test for realigned range