Made some fixes for errors found when running this in c9.io