Remove const_cast

* Fix a thread safe error reported by static analyser