Fixed bug where errors always went to stdout