fixed bug in state selection