fixed bug in saving previous ViewController's state