Fixed some issues that cause crashes

The rest of the scripts need to be modified, I don't have time to do
them all.
Merge pull request #1268 from ProjectSWGCore/master

Fixed some issues that cause crashes