added missing sanity check to append code