improve Context parent handling