Just some tweaks to avoid crashes