fix state reset when orientation change