Minor changes.
Fixed errors revealed by quickcheck.