make library thread save by replacing autoloads with requires

add support for ruby 2.0

Add handling for BasicObject in ruby 1.8/1.9 implementation