fixed some crashes