Fix crash trying to write to stdout
Fix compiler warning