Fixed wrong usage of handle scopes.