1.8.7 compatibility fix

This works for me in 1.8.7 and my test ruby 2.0.0p247.