Attempt to fix threading bug.