Revert "Revert "Update output params when needed""

This reverts commit 9e7d3c92458074d3089d43bd4da91ba80e11b5cb.
Fixed "Update output params when needed"