now compatible with ruby <1.9 - thanks to http://stackoverflow.com/a/4333552