a bunch of fixes

Change-Id: I3b34c4decbbfaa76b92afea4707b166ab0bf204a