Replace undefined with null