#93 fix fatal error caused by foreign key