Updated for PHP5.6 support