replace undefined with null