Fixed broken pipes and weird behaviour