[12359] Fix problems that caused client freezes.

Special thanks to Rog360 to narrow the issue down

(based on commit [12256] - aa17216)