Changed method to work with ruby ree 1.8.7