Core/Scripts: Fix possible NULL dereferences

Fix possible NULL dereferences probably caused by a typo.