add a smart writer to deal with indent