made code ruby 1.9 compatible