Added check for when threads is disabled.