Fixed weird crashes