fixing deadlock issue (hopefully)