Fixed possible memory leak