first implementation of function error