improved test coverage and minor fixes

Change-Id: I9a6d07f9def1fb8a4e5dbc87f82f768c49fd6c99