changed implementation for getting state number