Fixed a bug in Bergman normal form code as well as toString.