Crashes at various points due to undeclared variables

When locking the screen and then unlocking, this extension had a tendency to crash (something that could be seen in ~/.cache/gdm/session.log) - the reason being the assignment of undeclared variables. This patch fixes both issues and also removes two warnings.