fixed fairly critical bug in the KVP parser