applied patch
only call keyvalue once.