diff --git a/generator/lib/model/ForeignKey.php b/generator/lib/model/ForeignKey.php
index <HASH>..<HASH> 100644
--- a/generator/lib/model/ForeignKey.php
+++ b/generator/lib/model/ForeignKey.php
@@ -416,13 +416,15 @@ class ForeignKey extends XMLElement
 	 *
 	 * @return    ForeignKey
 	 */
-	public function getOtherFk()
+	public function getOtherFks()
 	{
+		$fks = array();
 		foreach ($this->getTable()->getForeignKeys() as $fk) {
 			if ($fk != $this) {
-				return $fk;
+				$fks[]= $fk;
 			}
 		}
+		return $fks;
 	}
 	
 	/**
diff --git a/generator/lib/model/Table.php b/generator/lib/model/Table.php
index <HASH>..<HASH> 100644
--- a/generator/lib/model/Table.php
+++ b/generator/lib/model/Table.php
@@ -679,7 +679,9 @@ class Table extends XMLElement implements IDMethod
     $crossFks = array();
     foreach ($this->getReferrers() as $refFK) {
       if ($refFK->getTable()->getIsCrossRef()) {
-        $crossFks[]= array($refFK, $refFK->getOtherFk());
+        foreach ($refFK->getOtherFks() as $crossFK) {
+          $crossFks[]= array($refFK, $crossFK);
+        }
       }
     }
     return $crossFks;
[<I>] Allowed more than two fkeys in a cross reference table (refs #<I>)