Fixed global context bug