fixed memory issue