Output flip bug fixed