upgraded code to ruby 1.9