correcting unit context management pattern