Fix database clearing