Fixed len reference in decode64 and change encode64 to reference len and
rem after type check.