Fixed bug to do with multiple outputs