Fixed form bug when switching between pages