added isset for undefined variables