Context update mask, fix bug where wrong ref was returned