fixed hanging problem