The sed's that were added in the previous version cause the mdata-get failure to go unnoticed. Together with the fact that the mdata-get prints errors on stdout, made set-root-authorized-keys think it succeeded (due to non-empty string result).