fix aliasing violation

cherry picked from vanir