Fixed bug for older PHP version