fixed minor bug in the discover function