Fixes cmake problems and some other compile time errors.