Fixed small memory bug