Populate history table, some bug fixes for special name cases