Fix several php errors