replacing TASK DATA.pid with APPDATA.tid