Update keys.c

Fixed error checking in callers of _keys_check_length()