replacing head -c with dd (for portability reasons, see #673)