Fixed newLastOrder function so the call completes