Fix infinite loop in decodeMap