fix out-of-memory bug, auto built up script