fixing bugs in readsession thread