Correct iterator usage (sync from NQP repo).
Adding missing encoding flag.