fixed some warnings and improved build system