Added check to see if the call to get the last key is failing. Added check to see if start and end keys are the same.