optimize the dump stack