solving memory problems