Removed ActiveRecord dependencies
Fixed null copy error