fixed writing error