switching states fixed