Fix problem with missing variable in scope