fix weird logic