fix mistakes in naming and foreign key
add additional database initialization statements