safer type assertions