Fix cross-platform primitives to work nicer