made some 1.8 adjustments (note to self: consider using backports gem)