Toggle: fixes #3431 toggle on/off behaviour

Bug was in the `getState` method - its `state` parameter was hiding the global `state` object.