Fixed isssues running looping nextTick from engine recursive code

Changed splice(0) to shift