Fix several minor behavorial bugs.