Bug fix Wrong logic