Extra checks to stop crashes