Fixed minor multi threading problem