fix casting issue