fixed memory violation. test up and running