Fixing the scripts for database