fixed some errors on database