don't overstep document bounds