minor fixes on badge logic