Fix bugs revealed by serious tests.