Added fix for if outputs or inputs are null.