Optimize the way to return NULL value