database backup and restore and some bugs fixed