fixes and build improvements