Solved a bug that caused a deadlock.