Attempt to fix thread-related freezing (again)