several minor bug fixes