fix casting to int