using lambda with scope to fix warning on specs