Fix stdout, remote detection, and branch detection