update activerecord and fix some bugs