support ruby 1.8.x

based on #508, WIP