changed outputs but weird infinite loop