Bug fixing logicoperation