Stolen proudly from here: https://github.com/gvmtool/gvm/issues/170 .  Let me tinker with it and see if I can remove the second call.