fix exception when parameter is NULL but is not nefined as optional