Remove debug flag
Ensure stream is defined before using it