fix alloc in a thread bug
Merge branch 'master' into diffbot