better type checking