fixed malloc call