Fix possible segfault in case of wrong argument.