bugfix: repeating $k and $i don't produce "undefined" now.