enhance 7548e68c31 to better check null first