Improved the p4est_ghost_is_valid function.