active record bug fixes