fixed most primary key issues