Add test to reproduce fk script bug.

refs #10
Fix bug in fk script on non-pk column.

refs #10