Properly handle context creation