Fix some crashes