Protecting against notices

Used the same technique as above to protect against notices for
accessing undefined offset.
Merge pull request #630