Fix test and empty selection cases

Change-Id: I641935239002136a71e6df9da6e426559f04b23e