Fixed logic to handle function as default value