Working on deadlock issue