fix and improve Tee class; bugfixes