fixed the deadlock issue