refactoring for php v < 5.4