Flush stdout instead of using stderr. Removed a dirty hack