Added a few fixes to ActiveRecord