Fixed some stuff for grid job checking.

TODO:
   * write some smarter checks of grid jobs
   * amalgamate my grid job output checking script into this
Also some minor changes to utils in various parts of the project.