fixing updateState so that it works in all modes/spaces