Fixes testcase.
Adds more tests.
Fixes missing foreign value entries.