Fix typehinting which needs to be more flexible.