fixing foreign key issue #24