compatibility fix 

The version of this fix I submitted yesterday inadvertently broke compatibility with php 5.3. This will fix that.
Merge pull request #538 from jijoel/master

compatibility fix