Fix a stupid mistake in the headless timeout.

Although, still need to figure out why it gets corrupted.
Oops, fix a bad sort for the hashmap.

Fixes assertion warnings.  Thanks @Kingcom.