fix bug with invalid query on belongs to eager load.