Minor fixes and buildsystem improvement