added check for id