Fixed comparison logic