Resolving a stability issue with an improperly allocated context