change flag to isPresent