Why not use http://api.drupal.org/api/drupal/includes!menu.inc/function/menu_get_object/7 that way no need to mess around with page arguments etc or have the strange logic in the if statement below.