Fix bugs in ProgramIO and AstIO