Fix bad logic