Bugfix: fix undefined index

when unset an array, we need to reindex the array