fix a few assorted bugs.