Logic error correction

#1265