Jx/ruby compatible fix

Fix various ruby compatible issue, one is a fix for ruby 1.9, others are fixes for ruby 1.8.