fixed bugs in parallel