fixed datwriter bug