Fixed multiple threads issue #4564