updated database scripts. Fixed errors.