fix bunches of php errors