added function to support php <5.4