Fix broken async locking in release build