fix all compile errors as a result of coding blind last night
add error headers
updated tests to only stream output once