update hash conversion to be compatible with older versions of ruby