added function and error