fix notices and PHP 5.4 warnings
Merge pull request #224 from dlobo/NoticeFixes

fix notices and PHP 5.4 warnings