upstream fixes for crashes