Fixing bug highlighted in PHP5.4