Fixed the code to be compatible with ruby 1.9.3 and Chiliproject 3.7.0