Fixes #21
Fixes #20
Merge pull request #22 from shrimpza/misc-2.2

PHP incompatibility fixes