Fixed nil error in state.rb