Fix mistaken synchronous code in tests