oops, *now* the battery detection function works properly.