fixed destructuring assign in global context. Updated tests. cf #883