Fixed for loops in Relation and FileIO, and ordering bugs in AST