type cases correctly