Fixed few crashes