Fixed smaller clang and OSX related bugs