Fixed couple of small bugs detected by LLVM