Feature #2398: Fix scope bug