Fix a few PHP notices and warnings