fixes bug relating replace function
multiple changes, focusing on making the pipeline on-the-fly