Fixed "threading" problem