scope bug fixed