Fix notices and using not-defined variables

you should run php-cs-fixer