fix updating of model contexts in query init code