fix bug in function "BeforeNavigate2"