refactor types check with reflection