Fix sql error for ambiguous fields in query due to default scopes