Fix for ArrayIndexOutOfBounds when printing results