fixed a few crashes