added typcase checking