Fixed issue in write