[PATCH] Fix segfault when failing to import keys