avoid deleting inside the mutex to avoid blocking main thread