made some changes that worked for PHP 5.3 but not for 5.4

added isset() checks