Fix in before_where and before_order_by