[Core] Segfaults fixes