Critical fix to context handling