fixed definition of function