add proper history support