Fixes crashes