fixes for crashes