fixed badge removal code