fixed bug with wrong scope variable being used

trying it again due to builder issue