Fix history navigation bug