small fixes and cleanups

The fixes are pretty straightforward.

However, command.cpp is still a mess (to put it mildly). Basically, most commits from the past four years should be reviewed by their authors to fix memory leaks and possible crashes. If they stay unfixed, most of the new commands should be checked, if they actually fit any sane use case - and if they don't, they should be removed.

Does cubescript really need "goto" constructs?

Also, one of the fixes plugs a huge cheat, so, if in doubt, merge them all :)