further simplified build process: removed necessity for UNICODE and _UNICODE flags. Also fixed minor problems and changes pointed out by code analysis