add more debug lines, correct some peek vs next