more bug fixes, clarified iostream usage