add WriteIf methods