[TASK] Add safeguard against undefined variable