Fixed bugs in parallelization