fixed a bunch of php warnings