update decode function