Revert "Revert "Fixed build issue when building in release mode""

This reverts commit 25dc70737621c4ace81434adcb1daa864219d493.