fixed outputBuilder's logic flow