check if state is defined before pushing or popping cfg
allow popState to handle multiple states with single call