Fixed Null while writing data