intermediate commit: two bug fixes and a hack