Fixed if-then logic to prevent access to null spell field