implemented deadlock