diff --git a/service/context.go b/service/context.go
index d53caf3b3a8b71693d5d81904cbb0d3388d1dcc0..79a7522cdd8ae3153191056383ad621779ba06ca 100644
--- a/service/context.go
+++ b/service/context.go
@@ -214,8 +214,9 @@ func (ctx *serviceContext) ValueOrDefault(name string, defaultValue interface{})
 }
 
 func (ctx *serviceContext) AuditChange(eventType string, orgValue, newValue interface{}) {
+	username, _ := ctx.Claim()["username"].(string)
 	event, err := audit.NewEvent(
-		ctx.Claim()["username"].(string), //use username as source (will default to "SYSTEM" if undefined)
+		username, //use username as source (will default to "SYSTEM" if undefined)
 		eventType,
 		orgValue,
 		newValue,