fix database error issues for good (hopefully)