Range normalization fix

This should fix selection bugs seen on pages with weird structure.
(Thus closing #235, and taking care of the failed test cases, too.)