Fixed bad logic