bugfix for parallel code