Fix NULL pointer dereference issue in initializer