fixed warning regarding uninitialized res