Fixed the reversed order of reward, state pairs.