add functions which deel with error