separated data() in two function raw_data() and data(). The interface
of data() should be the same as before. raw_data() is used in dlstats.
Fixed various bugs.