Fixed build for newly cloned projects

A freshly cloned repo will now build and run with no problems.
Also fixed some pinvoke issues.