Fixes and additions

- minor fixes
- added missing files to VisualStudio project
Fixes resulting from code analysis
Updated some lua functions