fix deadlock
remove unused code