using new getTypeCount() method instead of trying and waiting for an exception