Error messages / debug improvements / crash avoidance