Fix for crashes