fix job number caculation for extended workflow

fixes #5148