Fixed type checking for records to prevent cycles and unknown field types