Fix regression writing to cert dir