fix histogram and copy db to sdcard