Some crash fixes