Merge "Adding a sanity test in the while loop in readHistory()"