replace if with require