fix N+1 query