Fix duplicated output bug