use try when writing nil elements