Fix error logical code