repair bad "scope function"