add proper Indexing to WriteTask()