Fixed several PHP undefined warnings