Fixing possible memory leak