Some fixups for bugs found during testing

Change-Id: I82be2723d4feb43bd56dac8b6159bf36b928f64a