added customizable error functions