fixed used size of database (but totalsize is still incorrect)
included support for database total size