making the page handler a bit more bulletproof