Fixed htmlentities for older php versions