When adding references for omitted optional variables, reference variables are set to None instead of left undefined

See comments of this commit for more details