added null check for object