substitute null for undefined