Fixed two bugs that broke the keystore granting mechanism
am: 947a7c710e  -s ours

Change-Id: Ia0616116636f599545d3734db1fdbd78a18fdc8e