Fix bug with referencing config out of scope