fix memoryleaks