backport safe_constantize for ruby 1.9