Applying fixes from php.tools