Adding check for id

Checking to make sure an id exists before testing it.