Fix crash when creating multiple contexts