refined type checking