Fix bug in context handling
Add global context definition