Fix bug when casting non-relational field declared after relation

Reset $relType so casting doesn't treat all fields after relation as a relation.