ported to ruby version 2.1.4