Fix NULL reference