fix some error conditions
use ttl as safety net