XOR problem + bugfix