FINALLY FIXED THE DEADLOCK ISSUE