changes so code is now compatible with php version 5.2