Finally resolve splice() issue by using shift() instead