Hopefully finally fixed memory issue