fix N + 1 issue in courses