Fixes from @singingwolfboy in PR #3466