methods for handling deadlock