fix N + 1 problem