added defer/recover for the invocation of decoder.Decode()