refactoring; fix to the Test-UiaControlState cmdlet