Fix bug for earlier ruby versions