KEYS: Fix error handling in construct_key_and_link()