fixed a bug in parallel thread