fix: delete cascading defined by relationships

The bug is caused by the usage of the same variable name as function
input parameter and later as cycle variable, the latter replaces
original input parameter making remaining function code potentially
produce an error (even fatal error)