Fixes for compatibility with old ruby versions