Whitespace changes. No functionality has been modified.
Fix possible NULL dereference.
Improve logic in cast_spell().