Adding debug and error on unset variable to control script.