Make type testing more robust