added isset validation to if statement