resolved bugs in discover.cpp