improve nn.Module compatibility