Improve checks on output type
Merge branch 'master' into file