Fix incorrect pagebeforeshow forwarding and related test issue