fixed def of higher order function