Fix infinite history loading issue noted in #319