Fixing a minor logic problem