I had the same problem. When i changed the name of the variable from "switchState" to "switchstate" everything worked fine.