small change in the decodeTemplate loop