corrected a minor bug in mains power checking function which prevented discovery function to work