This looks good, but it does not cover the other issue (#2539) that you logged.