shelf key handle some edge conditions