Fix up spherical harmonics code