infinite loop fix
remove dead code