Bugfix in builtin functions: forgot to increment i in while loop