Upgraded to ruby 2.0 and fixed a query bug