resolved bugs with listen.cpp