Many cross-platform fixes