Use loaded_from only when non-nil

For a gem which is not installed in specified path
"loaded_from" will return nil and hence check for builtin_gem?
will throw error. This fixes bug#2915