assorted fixes from eric liu