Fix test synchronization