properly pipe o/p and error