add safer check for page variable