Fixed Invalid Handle issue