fixed cursor logic in ruby driver