BUGFIX: Declare variables and load settings before using them.