changed getStateNumber to fix failing test case for the edge case of 0