Fix wrong operators and compile warnings

Fix compile warnings under clang
Fix wrong bitwise and operator
Fix wrong use of delete operator