better type check