fix #1 memory issue