Bugfix/toplevel arrays

Fixing a previously unreported bug. Both insert and extract functionality assumed that the workspace (top level data object) should be an object, not an array. This caused data loss when the actual top level object is an array.