Assorted small bugfixes.

r anybody; there isn't anything complicated here