adding anti-hanging