added scratch space usage and fixed a bug that might arise in parallel job processing