debugging write method