Fixed foreign id handling when creating/updating positions