bug fixes for older php versions