Remove unnecessary if statements
Fix undefined index/offset
Fix code indentation
Fix undefined constant
Improve index/offset handling
Merge pull request #70 from Trainmaster/fix-PHP-notices

Fix PHP notices