Fixed NPE issue related to parent context.