make the type assertions safe