Fix error when range bounds are non-constant. Issue #36