fix foreach bug when type is string. fix bug of slice