extended smap_ functions; array_copy increments refs if needed