Fixed php bugs