updated DDL, fixed bugs