Finally fixed mainactivity state restoration (i hope).