fixed segfaults in get_key().