Compatibility fix

Adjusted to work with versions of PHP below 5.3