Inside of that function right before your $output is assigned to make sure that the $page variable has all of the information it needs, particularly the post_title and ID.If it does indeed have everything then I would look more closely to the timing on when apply_filters is being called.