last_key_val is uninitialized in the first iteration