Fix notices and using not-defined variables

The indentation is off though. It should be shifted left 8 spaces, no?