fixed some active record issues