add activerecord integration
fix bugs