Fixed a few PHP notices (thanks @mpeshev).