Fixup location handling, add test