fix bad crashes