More bugfixes and made __repr__ sane.