fixed unbounded memory issue.