ai and exit fixes