BugId:104520 - moved deleted page check to more appropriate place and tweaked the logic a little bit