Fix inconsistent history

Fixes bug 393