fixed bugs in RelationBuilder.java