fixing some context def bugs