Fixing an issue where threads were run synchronously