Backporting another fix from PyDAWv4 (a cherry-pick was not appropriate
here)