fixed more memory problems