Fixed a number of warnings and errors in native compilation