fix local value reference bug of 'encoding' argument