reimplementation of the subtyping