Optimize management of nil id