Modified getting for keyval by passing int pointer.