2pass optimization with a bug