diff --git a/legacyworlds-server-data/db-structure/parts/040-functions/170-events.sql b/legacyworlds-server-data/db-structure/parts/040-functions/170-events.sql
index cbcd8e0..8cdba58 100644
--- a/legacyworlds-server-data/db-structure/parts/040-functions/170-events.sql
+++ b/legacyworlds-server-data/db-structure/parts/040-functions/170-events.sql
@@ -40,7 +40,12 @@ CREATE TYPE events.evdef_create_result AS ENUM(
 	 * finalisation function when an event or field cannot be inserted due to
 	 * check failures.
 	 */
-	'BAD_SPEC'
+	'BAD_SPEC' ,
+	
+	/* This error code is returned when trying to finalise an event after one
+	 * of the definition calls failed. 
+	 */
+	'NO_DATA'
 );
 
 
@@ -166,6 +171,7 @@ BEGIN
 	IF LENGTH( _id ) < 2 OR LENGTH( _id ) > 48
 			OR NOT _id ~ '^[a-z\-]+$'
 	THEN
+		DELETE FROM evdef_temp;
 		RETURN 'BAD_ID'::events.evdef_create_result;
 	END IF;
 
@@ -463,6 +469,10 @@ BEGIN
 	SELECT INTO _rec *
 		FROM evdef_temp
 		WHERE evfld_id IS NULL;
+	IF NOT FOUND
+	THEN
+		RETURN 'NO_DATA';
+	END IF;
 
 	_qstr := 'INSERT INTO events.event_definitions (' ||
 				'evdef_id , evdef_priority , evdef_adjustable' ||