Fix issues running on PHP 5.4