Block binding: Handle nested scopes better

Issue #1358