correction on the logic