Fix problems with new PHP implementation