Fix a type error introduced by end().