fixed other potential sources of memory problems