Fix php extension bugs