Fix bad logic in conditional check