replace each_with_object to inject to support ruby 1.8.7