fix character iteration