fixes from dan code review