fix to issue 691 - we were incorrectly constructing foreign keys by convention in case of composite keys. CR: Arthur