fixed 2 memleaks, one is still left