Fixes for PHP notices in certain cases