Various fixes

Doesn't work with older ruby (see this precise commit)