write counter to stderr