fix a bug in parallel mode