Fixed #3216, added toString() before using slice()

Sometimes there's a float number which doesn't have #slice method.