palgorithm: ThreadSafeResource: crash fix