fix active record function