Fix database preparation