fix relationsToArray

not unsetting the relations variable might lead to setting the next key with the previous value if the current value is not an instanceof the ArrayableInterface of null.