add some crash checks