sort events, other misc fixes