fixed some issues with teeing output