error checking.

Found a few problems, mostly with ST commands and fixed them.