Fix for loops in truthtable