fix casting relations