Problem with child window



I'm trying to access a dialog/window which is spawned as a child from the mainform. On other dialogs it works fine, but on this particular dialog the whole UIA framework seems to be freezing. Only after I close the child dialog/window, the UIAFramework continues:

Using the .net4 variant btw.

Working code for "new package dialog":
$global:GUIMainForm = Get-UIAWindow -ProcessName "Automation Machine" -TimeOut 10000 -name "*Automation Machine*"

$GUIMainForm | Get-UiaListItem -Name 'New Package' | Invoke-UIAControlClick
        # Check if new package dialog was opened
        $GUIMainForm | Test-UIAControlState -SearchCriteria @{automationId="AMPackageDialog";controltype="Window";name="Create new Package"} | Should be $true
        $NewPackageDialog = Get-UIAWindow -automationId "AMPackageDialog" -Name "Create new Package"
        # Add button should be disabled when no text has been entered
        $NewPackageDialog | Test-UIAControlState -SearchCriteria @{automationId="buttonOk";controltype="Button";name="Add";IsEnabled=$false}
not working code for "Filter builder dialog"
$global:GUIMainForm = Get-UIAWindow -ProcessName "Automation Machine" -TimeOut 10000 -name "*Automation Machine*"
# clicks the filter button, opens the filter dialog
$GUIMainForm | Get-UiaControl -AutomationId "buttonFilter" | Invoke-uiaControlClick
# The following doesn't work, UIA seems to be hanging indefinately untill I close the opened dialog.

$GUIMainForm | Test-UIAControlState -SearchCriteria @{automationId="FilterExpressionBuilderDialog";controltype="Window";name="Filters: Default action set"}

# This works, get's the dialog and highligts it
$FilterDialog = get-uiawindow -Name "Filters: Default action set"
# Anything I try on the $FilterDialog seems to hang the UIA indefinately, cannot get buttons or anything without haning the UIA framework.