checkin with bunch of fixes from unit testing