Fixed deadlock in test