Fixed bugs in pipeline.py