Fixed a bug that cause the whole script to break. And a few other syntax
improvements.