decode magic prefix headers