Fixed real and false bugs reported by Clang