Fixed database bug

Fixed bug involving mis-matched datatypes for foreign key references.