Slightly fixed memory problems