fixed up memory weirdness errors