fixing a bug in the PnP page JS