Make CP work consistently cross-platform; fixes #22