Fixed multi-theading issue