Added fixes from the ScatteringCPU project.