Fix update code to correctly handle stdout