Improve checks on output type