Fixing bug in context registration