various small bug fixes

Change-Id: I2fee10c7f82a7c3ba02356b7269a7a58272d3432