Cosmetic patch + compile fixes + build system improvements

See commit messages for further information.