Adding fixes suggested in issue #180
Merge pull request #181 from jrfnl/Bugfix-some-PHP-warnings

Fix some php warnings