fixbug: too many open files
remove some debug code