Fixed an infinite loop bug with unshift on empty arrays