Fixed a few errors that prevented execution

Fixed a number of very small issues, could someone please verify that these changes do work on other platforms and then merge to master?