Fixes for PHP5.6 -> PHP7 upgrade