fixed memory leaks and added test for construters and GetChar