Fix coredump for when an ID is used illegally outside a record